#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
@File Name: cnblogs_spider_tester.py
@Author: LTisme
@Date: 2021/8/1 16:30
@Description: 
"""
import unittest
# from scrapy.crawler import CrawlerProcess
# from .cnblogs_spider import CnBlogsSpider
import os

# cnblogs最里面的spiders文件夹的路径
path = os.path.dirname(__file__)


class MyTestCase(unittest.TestCase):
    def test_cnblog_spider(self):
        # process = CrawlerProcess()  # 也可以不设置参数
        # process.crawl(CnBlogsSpider)
        # process.start()
        os.chdir(path)
        os.system("scrapy crawl cnblogs -o papers.csv")


if __name__ == '__main__':
    # 这种方式虽然可以执行，但不如cmd命令行使用命令执行
    unittest.main()
